package com.ufgov.zc.client.zc.expertselection;import static com.ufgov.zc.common.system.constants.ZcElementConstants.TITLE_TRANS_EM_EXPERT_PRO_BILL;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Component;import java.awt.DefaultKeyboardFocusManager;import java.awt.Font;import java.awt.Toolkit;import java.awt.Dialog.ModalityType;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.KeyAdapter;import java.awt.event.KeyEvent;import java.text.NumberFormat;import java.text.SimpleDateFormat;import java.util.ArrayList;import java.util.Date;import java.util.HashMap;import java.util.HashSet;import java.util.Iterator;import java.util.List;import java.util.Map;import java.util.Set;import java.util.Timer;import java.util.TimerTask;import javax.swing.AbstractAction;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JComponent;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JSplitPane;import javax.swing.JTabbedPane;import javax.swing.JTable;import javax.swing.JTextArea;import javax.swing.KeyStroke;import javax.swing.border.TitledBorder;import javax.swing.plaf.metal.MetalBorders.OptionDialogBorder;import org.apache.log4j.Logger;import com.ufgov.smartclient.common.UIUtilities;import com.ufgov.smartclient.component.table.fixedtable.JPageableFixedTable;import com.ufgov.zc.client.common.AsOptionMeta;import com.ufgov.zc.client.common.BillElementMeta;import com.ufgov.zc.client.common.LangTransMeta;import com.ufgov.zc.client.common.ListCursor;import com.ufgov.zc.client.common.WorkEnv;import com.ufgov.zc.client.common.converter.ZcEmExpertSelectionToTableModelConverter;import com.ufgov.zc.client.component.AsValComboBox;import com.ufgov.zc.client.component.GkBaseDialog;import com.ufgov.zc.client.component.GkCommentDialog;import com.ufgov.zc.client.component.GkCommentUntreadDialog;import com.ufgov.zc.client.component.JFuncToolBar;import com.ufgov.zc.client.component.JTablePanel;import com.ufgov.zc.client.component.WorkflowTrace;import com.ufgov.zc.client.component.button.AddButton;import com.ufgov.zc.client.component.button.CallbackButton;import com.ufgov.zc.client.component.button.DeleteButton;import com.ufgov.zc.client.component.button.EditButton;import com.ufgov.zc.client.component.button.EvalExpertButton;import com.ufgov.zc.client.component.button.ExitButton;import com.ufgov.zc.client.component.button.FuncButton;import com.ufgov.zc.client.component.button.HelpButton;import com.ufgov.zc.client.component.button.NextButton;import com.ufgov.zc.client.component.button.PauseEvalExpertButton;import com.ufgov.zc.client.component.button.PreviousButton;import com.ufgov.zc.client.component.button.PrintButton;import com.ufgov.zc.client.component.button.PrintPreviewButton;import com.ufgov.zc.client.component.button.PrintSettingButton;import com.ufgov.zc.client.component.button.SaveButton;import com.ufgov.zc.client.component.button.SendButton;import com.ufgov.zc.client.component.button.ShowInfoButton;import com.ufgov.zc.client.component.button.SuggestAuditPassButton;import com.ufgov.zc.client.component.button.TraceButton;import com.ufgov.zc.client.component.button.UnauditButton;import com.ufgov.zc.client.component.button.UntreadButton;import com.ufgov.zc.client.component.table.BeanTableModel;import com.ufgov.zc.client.component.table.celleditor.IntCellEditor;import com.ufgov.zc.client.component.table.celleditor.TextCellEditor;import com.ufgov.zc.client.component.table.celleditor.zc.ZcEmExpertTypeSelectionCellEditor;import com.ufgov.zc.client.component.table.cellrenderer.DateTime24CellRenderer;import com.ufgov.zc.client.component.table.codecellrenderer.AsValCellRenderer;import com.ufgov.zc.client.component.ui.fieldeditor.AbstractFieldEditor;import com.ufgov.zc.client.component.zc.AbstractMainSubEditPanel;import com.ufgov.zc.client.component.zc.ZcEmExperteHandler;import com.ufgov.zc.client.component.zc.ZcEmProMakeHandler;import com.ufgov.zc.client.component.zc.fieldeditor.AsValFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.AutoNumFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.DateFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.ForeignEntityDialog;import com.ufgov.zc.client.component.zc.fieldeditor.ForeignEntityFieldCellEditor;import com.ufgov.zc.client.component.zc.fieldeditor.FractionDigitsFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.ProMakeNewFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.TextFieldEditor;import com.ufgov.zc.client.print.PrintPreviewer;import com.ufgov.zc.client.print.PrintSettingDialog;import com.ufgov.zc.client.print.Printer;import com.ufgov.zc.client.util.SwingUtil;import com.ufgov.zc.client.zc.ButtonStatus;import com.ufgov.zc.client.zc.ZcUtil;import com.ufgov.zc.common.system.Guid;import com.ufgov.zc.common.system.RequestMeta;import com.ufgov.zc.common.system.constants.ZcSettingConstants;import com.ufgov.zc.common.system.dto.ElementConditionDto;import com.ufgov.zc.common.system.dto.PrintObject;import com.ufgov.zc.common.system.model.AsVal;import com.ufgov.zc.common.system.util.DateUtil;import com.ufgov.zc.common.system.util.DigestUtil;import com.ufgov.zc.common.system.util.ObjectUtil;import com.ufgov.zc.common.zc.model.EmCallExpertRecord;import com.ufgov.zc.common.zc.model.EmEvaluationCondition;import com.ufgov.zc.common.zc.model.EmExpert;import com.ufgov.zc.common.zc.model.EmExpertBillFilter;import com.ufgov.zc.common.zc.model.EmExpertEvaluation;import com.ufgov.zc.common.zc.model.EmExpertSelectionBill;import com.ufgov.zc.common.zc.model.EmExpertType;import com.ufgov.zc.common.zc.model.EmProMake;import com.ufgov.zc.common.zc.model.ZcBaseBill;import com.ufgov.zc.common.zc.publish.IZcEmExpertSelectionServiceDelegate;public class ZcEmExpertSelectionEditPanel extends AbstractMainSubEditPanel {  private static final long serialVersionUID = -8330517047010771537L;  private static final Logger logger = Logger.getLogger(ZcEmExpertSelectionEditPanel.class);  protected IZcEmExpertSelectionServiceDelegate zcEmExpertSelectionServiceDelegate;  protected RequestMeta requestMeta = WorkEnv.getInstance().getRequestMeta();  private String compoId = "ZC_EM_EXPERT_SELECTION";  private FuncButton addButton = new AddButton();  private FuncButton saveButton = new SaveButton();  private FuncButton deleteButton = new DeleteButton();  private FuncButton previousButton = new PreviousButton();  private FuncButton editButton = new EditButton();  private FuncButton nextButton = new NextButton();  private FuncButton exitButton = new ExitButton();  private FuncButton helpButton = new HelpButton();  private FuncButton selectExpertButton = new EvalExpertButton();  private FuncButton pauseEvalExpertButton = new PauseEvalExpertButton();  private FuncButton showInfoButton = new ShowInfoButton();  private PrintButton printButton = new PrintButton();  private PrintPreviewButton printPreviewButton = new PrintPreviewButton();  private PrintSettingButton printSettingButton = new PrintSettingButton();  //工作流送审  private SendButton sendButton = new SendButton();  // 工作流填写意见审核通过  private FuncButton suggestPassButton = new SuggestAuditPassButton();  // 工作流收回  private FuncButton callbackButton = new CallbackButton();  // 工作流退回  private FuncButton unTreadButton = new UntreadButton();  // 工作流销审  private FuncButton unAuditButton = new UnauditButton();  //工作流跟踪  private FuncButton traceButton = new TraceButton();  @SuppressWarnings("unchecked")  private final ListCursor listCursor;  private volatile EmExpertSelectionBill currentBill;  private EmExpertSelectionBill oldBill;  private ZcEmExpertSelectionListPanel listPanel;  private JTablePanel tablePanel = new JTablePanel();  private ZcEmExpertSelectionEditPanel self = this;  private GkBaseDialog parent;  private String pageStatus = ZcSettingConstants.PAGE_STATUS_BROWSE;  private ArrayList<ButtonStatus> btnStatusList = new ArrayList<ButtonStatus>();  private BillElementMeta billElementMeta = BillElementMeta.getBillElementMetaWithoutNd(this.compoId);  private ForeignEntityDialog forenEntityDialog;  private JTabbedPane tabPane;  private JTablePanel packJTabelPanel = new JTablePanel("projectPackageCondition");  private JTablePanel conditionJTabelPanel = new JTablePanel("expertSelectionCondition");  private JTablePanel excludeJTabelPanel = new JTablePanel("excludeExpertList");  private JTablePanel resultJTabelPanel = new JTablePanel("expertSelectionResult");  private JTablePanel callRecordsJTabelPanel = new JTablePanel("callRecord");  private TextFieldEditor billPlaceEditor;  private AsValFieldEditor billTypeEditor;  private DateFieldEditor  tendersTimeEditor;  private FractionDigitsFieldEditor estimateTimeEditor;  private TextFieldEditor makeNameEditor;  private TextFieldEditor linkManEditor;  private TextFieldEditor telEditor;  private TextFieldEditor agencyNameEditor;  private Map<String, String> paramMap = new HashMap<String, String>();  private boolean showExpertInfo = false;  final JTextArea callInfoArea = new JTextArea();  final JTextArea msgInfoArea = new JTextArea();  Timer timer;  private JFuncToolBar ppcToolBarPpc;  private JFuncToolBar escToolBarEsc;  private JFuncToolBar eelToolBarEel;  private JFuncToolBar callInfoBar;  private JFuncToolBar msgInfoBar;  private boolean isComplete;  //是否显示抽取结果表下面的按钮，是个开关，为true时，显示，为false时不显示。  private boolean showBtns=false;  //抽取结果表下面的工具栏  private JFuncToolBar selectedExpertBtnBar = new JFuncToolBar();    //呼叫记录表下面的工具栏  private JFuncToolBar callRecordsToolbar = new JFuncToolBar();  @SuppressWarnings("unchecked")  public ZcEmExpertSelectionEditPanel(ZcEmExpertSelectionDialog dialog, ListCursor listCursor, String tabStatus,    ZcEmExpertSelectionListPanel listPanel) {    super(new EmExpertSelectionBill(), listPanel.compoId);    callInfoArea.setEditable(true);    callInfoArea.setLineWrap(true);    msgInfoArea.setEditable(true);    msgInfoArea.setLineWrap(true);    this.compoId = listPanel.compoId;    this.listCursor = listCursor;    this.listPanel = listPanel;    this.zcEmExpertSelectionServiceDelegate = listPanel.getZcEmExpertSelectionServiceDelegate();    this.parent = dialog;    this.workPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), this.listPanel.getTitle(), TitledBorder.CENTER,      TitledBorder.TOP, new Font("宋体", Font.BOLD, 15), Color.BLUE));    this.colCount = 3;    init();    requestMeta.setCompoId(compoId);    refreshData();//增加键盘监听事件，按下ctrl+enter时，设置已选择专家列表下增删按钮工具栏的隐藏于现实    getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.CTRL_MASK), "newAction");    getActionMap().put("newAction", new AbstractAction() {      public void actionPerformed(ActionEvent e) {        showBtns=!showBtns;        setSelectedExpertButtonsStatus(showBtns);      }    });      }  @SuppressWarnings("unchecked")  public ZcEmExpertSelectionEditPanel(ZcEmExpertSelectionDialog dialog, ListCursor listCursor, String tabStatus,    ZcEmExpertSelectionListPanel listPanel, ForeignEntityDialog forenEntityDialog) {    this(dialog, listCursor, tabStatus, listPanel);    this.forenEntityDialog = forenEntityDialog;  }    //根据标识设置专家抽取结果表下面的按钮的状态  protected void setSelectedExpertButtonsStatus(boolean status) {    // TODO Auto-generated method stub    selectedExpertBtnBar.setVisible(status);    showInfoButton.setVisible(status);    callRecordsToolbar.setVisible(status);  }  @SuppressWarnings("unchecked")  private void refreshData() {    this.currentBill = (EmExpertSelectionBill) this.listCursor.getCurrentObject();    if (currentBill == null) {      this.pageStatus = ZcSettingConstants.PAGE_STATUS_NEW;      currentBill = new EmExpertSelectionBill();      currentBill.setPackList(new ArrayList());      currentBill.setExpertEvalConditionList(new ArrayList());      currentBill.setExcludeExpertList(new ArrayList());      currentBill.setExpertEvaluationList(new ArrayList());      currentBill.setCallExpertRecordList(new ArrayList());      currentBill.setBillStatus(EmExpertSelectionBill.BILL_STATUS_NEW);      currentBill.setInputorDate(this.requestMeta.getSysDate());      currentBill.setInputorName(this.requestMeta.getSvUserName());      setDefualtValue(currentBill, ZcSettingConstants.PAGE_STATUS_NEW);      List list = new ArrayList();      list.add(currentBill);      this.listCursor.setDataList(list, -1);      listCursor.setCurrentObject(currentBill);    } else {      this.pageStatus = ZcSettingConstants.PAGE_STATUS_BROWSE;      paramMap.put("EM_BILL_CODE", currentBill.getBillCode());      currentBill = zcEmExpertSelectionServiceDelegate.getModel(paramMap, requestMeta);      List evalConditionList = zcEmExpertSelectionServiceDelegate.getEvaluationConditionList(paramMap, requestMeta);      currentBill.setExpertEvalConditionList(evalConditionList);      List expertBillFilterList = zcEmExpertSelectionServiceDelegate.getExpertBillFilterList(paramMap, requestMeta);      currentBill.setExcludeExpertList(expertBillFilterList);      List expertEvaluationList = zcEmExpertSelectionServiceDelegate.getExpertEvaluationList(paramMap, requestMeta);      currentBill.setExpertEvaluationList(expertEvaluationList);      List callExpertRecordList = zcEmExpertSelectionServiceDelegate.getCallExpertRecordList(paramMap, requestMeta);      currentBill.setCallExpertRecordList(callExpertRecordList);      List packList = zcEmExpertSelectionServiceDelegate.getPackList(paramMap, requestMeta);      currentBill.setPackList(packList);      currentBill.setDbDigest(currentBill.digest());    }    setEditingObject(currentBill);    //    tabPane.repaint();    refreshSubTableData(currentBill);    resetSubTable();    setMsgInfo();    setCallInfo();    setButtonStatus();    updateFieldEditorsEditable();    updateWFEditorEditable(currentBill, requestMeta);    setOldObject();        createThreadRefreshEelAndCrlSubTable();  }  private void setCallInfo() {    String str = currentBill.getCallInfo();    if (str == null || "".equals(str.trim())) {      str = "";      return;    }    str = str.substring(0, str.indexOf("同意请按1，不同意请按2，重新收听请按0。"));    callInfoArea.setText(str);  }  private void setMsgInfo() {    msgInfoArea.setText(currentBill.getMsgInfo() == null ? "" : currentBill.getMsgInfo());  }  /*   * 创建更新数据定时器   */  private void createThreadRefreshEelAndCrlSubTable() {    //这些状态下，不从后台更新数据了    if ((EmExpertSelectionBill.BILL_STATUS_SELECT_FINISH.equals(currentBill.getBillStatus()) && isCompleteEval())      ||(EmExpertSelectionBill.BILL_STATUS_SELECT_PAUSE.equals(currentBill.getBillStatus()))      ||(EmExpertSelectionBill.BILL_STATUS_SELECT_FAIL.equals(currentBill.getBillStatus()) ||EmExpertSelectionBill.BILL_STATUS_SELECT_NOT_ENAUGH.equals(currentBill.getBillStatus()))      ){            return;    }        //模拟抽取和录入历史状态，不从后台更新熟    if("Y".equalsIgnoreCase(AsOptionMeta.getOptVal("ZC_OPT_EXPERT_FAKE_SELECT"))){      return;    }        timer = new Timer();    TimerTask timerTask = new TimerTask() {      @Override      public void run() {        //获取数据        paramMap.put("EM_BILL_CODE", currentBill.getBillCode());        EmExpertSelectionBill emExpertSelectionBill = zcEmExpertSelectionServiceDelegate.getModel(paramMap, requestMeta);        currentBill.setBillStatus(emExpertSelectionBill.getBillStatus());        //    	currentBill = (EmExpertSelectionBill)listCursor.getCurrentObject();        refreshEelAndCrlSubTablePaneData();        //创建线程更新界面        createThreadRefreshEelAndCrlSubTablePane();        if (EmExpertSelectionBill.BILL_STATUS_SELECT_PAUSE.equals(currentBill.getBillStatus())) {          //暂停，停止          timer.cancel();          System.gc();          refreshData();        } else if (EmExpertSelectionBill.BILL_STATUS_SELECT_FAIL.equals(currentBill.getBillStatus()) ||EmExpertSelectionBill.BILL_STATUS_SELECT_NOT_ENAUGH.equals(currentBill.getBillStatus())) {          //抽取结束,但是抽取到的专家个数小于实际需求数量                 //completeButNotSucess();          showCompleteAndNotAccordMsg();          timer.cancel();          System.gc();          refreshData();        } else if (EmExpertSelectionBill.BILL_STATUS_SELECT_FINISH.equals(currentBill.getBillStatus()) && isCompleteEval()) {          refreshData();          // 抽取完成          completeEval();          timer.cancel();          System.gc();          // 显示抽取结果          showCompleteMsg();          return;                  }      }    };    if (EmExpertSelectionBill.BILL_STATUS_SELECTING.equals(currentBill.getBillStatus())) {      timer.schedule(timerTask, 1000, 3000);    }  }  /**   * 显示抽取结束信息。抽取结束，但是抽取的专家个数不符合要求   */  public void showCompleteAndNotAccordMsg() {    // 抽取结果记录    List eeList = currentBill.getExpertEvaluationList();    // 抽取条件记录    List cList = currentBill.getExpertEvalConditionList();    // 需要抽取专家的人数    int emCout = 0;    // 抽取结果的人数    int emresCout = 0;    if (eeList != null && eeList.size() > 0) {      emresCout = eeList.size();    }    if (cList != null && cList.size() > 0) {      for (int i = 0; i < cList.size(); i++) {        EmEvaluationCondition eec = (EmEvaluationCondition) cList        .get(i);        emCout = emCout + eec.getExpertNum();      }    }    StringBuilder msg = new StringBuilder("<html>此次抽取专家不成功，需要抽取专家<font color='red'><b>");    msg.append(emCout);    msg.append("</b></font>人，实际抽取到<font color='red'><b>");    msg.append(emresCout);    msg.append("</b></font>人，缺失<font color='red'><b>");    msg.append(emCout - emresCout);    msg.append("</b></font>人！</html>");        StringBuffer sb=new StringBuffer();        sb.append("此次抽取专家不成功，需要抽取专家").append(emCout).append("人，实际抽取到").append(emresCout).append("人，缺失").append(emCout - emresCout).append("人！");    JOptionPane.showMessageDialog(this, sb.toString(), "提示", JOptionPane.INFORMATION_MESSAGE);  }  /*   * 显示抽取完成后的结果信息   */  public void showCompleteMsg() {    // 抽取结果记录    List eeList = currentBill.getExpertEvaluationList();    // 抽取条件记录    List cList = currentBill.getExpertEvalConditionList();    // 需要抽取专家的人数    int emCout = 0;    // 抽取结果的人数    int emresCout = 0;    if (eeList != null && eeList.size() > 0) {      emresCout = eeList.size();    }    for (int i = 0; i < cList.size(); i++) {      EmEvaluationCondition eec = (EmEvaluationCondition) cList.get(i);      emCout = emCout + eec.getExpertNum();    }    StringBuilder msg = new StringBuilder("<html>此次抽取专家结束，需要抽取专家<font color='red'><b>");    msg.append(emCout);    msg.append("</b></font>人，实际抽取到<font color='red'><b>");    msg.append(emresCout);    msg.append("</b></font>人！</html>");    StringBuffer sb=new StringBuffer();    sb.append("此次抽取专家结束，需要抽取专家").append(emCout).append("人，实际抽取到").append(emresCout).append("人！");        JOptionPane.showMessageDialog(this, sb.toString(), "提示", JOptionPane.INFORMATION_MESSAGE);  }  /*   * 抽取过程结束，但是没有完成抽取，抽取失败   */  protected void completeButNotSucess() {    currentBill.setBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FAIL);    boolean success = true;    String errorInfo = "";    try {      currentBill = zcEmExpertSelectionServiceDelegate.saveFN(currentBill, requestMeta);    } catch (Exception e) {      logger.error(e.getMessage(), e);      success = false;      errorInfo += e.getMessage();    }    if (success) {      this.listCursor.setCurrentObject(currentBill);      paramMap.put("EM_BILL_CODE", currentBill.getBillCode());      this.listPanel.refreshCurrentTabData();      this.pageStatus = ZcSettingConstants.PAGE_STATUS_BROWSE;      updateFieldEditorsEditable();      setOldObject();    }    setButtonStatus();  }  /*   * 完成抽取   */  protected void completeEval() {    currentBill.setBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FINISH);    boolean success = true;    String errorInfo = "";    try {      currentBill = zcEmExpertSelectionServiceDelegate.saveFN(currentBill, requestMeta);    } catch (Exception e) {      logger.error(e.getMessage(), e);      success = false;      errorInfo += e.getMessage();    }    if (success) {      this.listCursor.setCurrentObject(currentBill);      paramMap.put("EM_BILL_CODE", currentBill.getBillCode());      this.listPanel.refreshCurrentTabData();      this.pageStatus = ZcSettingConstants.PAGE_STATUS_BROWSE;      updateFieldEditorsEditable();      setOldObject();    }    setButtonStatus();  }  public void resetSubTable() {    translateSubTableColumn();    setSubTableCellEditor();  }  private void translateSubTableColumn() {    ZcUtil.translateColName(packJTabelPanel.getTable(), ZcEmExpertSelectionToTableModelConverter.ppcColumns);    ZcUtil.translateColName(conditionJTabelPanel.getTable(), ZcEmExpertSelectionToTableModelConverter.escColumns);    ZcUtil.translateColName(excludeJTabelPanel.getTable(), ZcEmExpertSelectionToTableModelConverter.eelColumns);    ZcUtil.translateColName(resultJTabelPanel.getTable(), ZcEmExpertSelectionToTableModelConverter.esrColumns);    ZcUtil.translateColName(callRecordsJTabelPanel.getTable(), ZcEmExpertSelectionToTableModelConverter.crColumns);  }  private void setSubTableCellEditor() {    //    setPpcSubTableCellEditor(ppcJTabelPanel.getTable());    setConditionTableCellEditor(conditionJTabelPanel.getTable());    setExcludeTableCellEditor(excludeJTabelPanel.getTable());    setResultTableCellEditor(resultJTabelPanel.getTable());    setCallProcessTableCellEditor(callRecordsJTabelPanel.getTable());  }  private void setResultTableCellEditor(final JPageableFixedTable table) {    // TODO Auto-generated method stub    table.setDefaultEditor(String.class, new TextCellEditor());    SwingUtil.setTableCellEditor(table, ZcEmExpertSelectionToTableModelConverter.EM_EXPERT_TPYE_CODE, new ZcEmExpertTypeSelectionCellEditor());//    SwingUtil.setTableCellEditor(table, ZcEmExpertSelectionToTableModelConverter.DOCTOR_NUM, new IntCellEditor());        ZcEmExperteHandler handler = new ZcEmExperteHandler() {      @SuppressWarnings("unchecked")      @Override      public void excute(List selectedDatas) {        BeanTableModel model = (BeanTableModel) table.getModel();        int k = table.getSelectedRow();        if (k < 0) {          return;        }        int k2 = table.convertRowIndexToModel(k);        EmExpertEvaluation ebf = (EmExpertEvaluation) (model.getBean(k2));        for (Object obj : selectedDatas) {          EmExpert expert = (EmExpert) obj;          ebf.setEmExpert(expert);        }        model.fireTableRowsUpdated(k, k);      }    };    ElementConditionDto dto = new ElementConditionDto();    ForeignEntityFieldCellEditor foreignExpertCodeEditor = new ForeignEntityFieldCellEditor(handler.getSqlId(), dto, 20, handler, handler      .getColumNames(), "专家列表", "emExpertCode");    SwingUtil.setTableCellEditor(table, ZcEmExpertSelectionToTableModelConverter.EM_EXPERT_CODE, foreignExpertCodeEditor);  }  @SuppressWarnings("unchecked")  private void refreshSubTableData(EmExpertSelectionBill bill) {    packJTabelPanel.setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmExpertBillPackageToTableMode(bill.getPackList()));    conditionJTabelPanel.setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmEvaluationConditionToTableMode(bill.getExpertEvalConditionList()));    excludeJTabelPanel.setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmExpertBillFilterToTableMode(bill.getExcludeExpertList()));    resultJTabelPanel.setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmExpertEvaluationToTableMode(bill.getExpertEvaluationList(),showExpertInfo));    callRecordsJTabelPanel.setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmCallExpertRecordToTableMode(bill.getCallExpertRecordList(),showExpertInfo));  }  //  private void setPpcSubTableCellEditor(final JTable table) {  //    table.setDefaultEditor(String.class, new TextCellEditor());  //  //    ZcEmPackHandler handler = new ZcEmPackHandler() {  //      @SuppressWarnings("unchecked")  //      @Override  //      public void excute(List selectedDatas) {  //        BeanTableModel model = (BeanTableModel) table.getModel();  //        int k = table.getSelectedRow();  //        if (k < 0) {  //          return;  //        }  //        int k2 = table.convertRowIndexToModel(k);  //        ZcEbPack ebf = (ZcEbPack) (model.getBean(k2));  //        for (Object obj : selectedDatas) {  //          ZcEbPack pack = (ZcEbPack) obj;  //          ebf.setProjCode(pack.getProjCode());  //          ebf.setPackCode(pack.getPackCode());  //          ebf.setPackName(pack.getPackName());  //          ebf.setPurContent(pack.getPurContent());  //        }  //        model.fireTableRowsUpdated(k, k);  //      }  //    };  //    ElementConditionDto dto = new ElementConditionDto();  //    ForeignEntityFieldCellEditor foreignExpertCodeEditor = new ForeignEntityFieldCellEditor(handler  //      .getSqlId(), dto, 20, handler, handler.getColumNames(), "分包列表");  //    SwingUtil.setTableCellEditor(table, "分包编号", foreignExpertCodeEditor);  //  }  private void setConditionTableCellEditor(final JTable table) {    table.setDefaultEditor(String.class, new TextCellEditor());    SwingUtil.setTableCellEditor(table, ZcEmExpertSelectionToTableModelConverter.EM_EXPERT_TPYE_CODE, new ZcEmExpertTypeSelectionCellEditor());    SwingUtil.setTableCellEditor(table, ZcEmExpertSelectionToTableModelConverter.DOCTOR_NUM, new IntCellEditor());  }  private void setCallProcessTableCellEditor(final JTable table) {    table.setDefaultEditor(String.class, new TextCellEditor());        SwingUtil.setTableCellEditor(table, ZcEmExpertSelectionToTableModelConverter.EM_EXPERT_TPYE_CODE, new ZcEmExpertTypeSelectionCellEditor());    SwingUtil.setTableCellRenderer(table, ZcEmExpertSelectionToTableModelConverter.CALL_TIME, new DateTime24CellRenderer());    SwingUtil.setTableCellRenderer(table, ZcEmExpertSelectionToTableModelConverter.CALL_STATE, new AsValCellRenderer("ZC_VS_CALL_STATE"));  }  private void setExcludeTableCellEditor(final JTable table) {    table.setDefaultEditor(String.class, new TextCellEditor());    ZcEmExperteHandler handler = new ZcEmExperteHandler() {      @SuppressWarnings("unchecked")      @Override      public void excute(List selectedDatas) {        BeanTableModel model = (BeanTableModel) table.getModel();        int k = table.getSelectedRow();        if (k < 0) {          return;        }        int k2 = table.convertRowIndexToModel(k);        EmExpertBillFilter ebf = (EmExpertBillFilter) (model.getBean(k2));        for (Object obj : selectedDatas) {          EmExpert expert = (EmExpert) obj;          ebf.setEmExpert(expert);        }        model.fireTableRowsUpdated(k, k);      }    };    ElementConditionDto dto = new ElementConditionDto();    ForeignEntityFieldCellEditor foreignExpertCodeEditor = new ForeignEntityFieldCellEditor(handler.getSqlId(), dto, 20, handler, handler      .getColumNames(), "专家列表", "emExpertCode");    SwingUtil.setTableCellEditor(table, ZcEmExpertSelectionToTableModelConverter.EM_EXPERT_CODE, foreignExpertCodeEditor);  }  private void setButtonStatus() {    EmExpertSelectionBill bill = (EmExpertSelectionBill) listCursor.getCurrentObject();        setSubPanelButton(this.ppcToolBarPpc);    setSubPanelButton(this.escToolBarEsc);    setSubPanelButton(this.eelToolBarEel);    setSubPanelButton(this.callInfoBar);    setSubPanelButton(this.msgInfoBar);    setButtonStatus(bill, requestMeta, listCursor);  }  public void setButtonStatusWithoutWf(){  EmExpertSelectionBill bill = (EmExpertSelectionBill) listCursor.getCurrentObject();  if (this.btnStatusList.size() == 0) {    ButtonStatus bs = new ButtonStatus();    bs.setButton(this.addButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);    btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(this.editButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_NEW);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FAIL);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_PAUSE);        bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_NOT_ENAUGH);        bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FINISH);    btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(this.printButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FINISH);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FAIL);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_PAUSE);        bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_NOT_ENAUGH);    btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(this.printPreviewButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_PAUSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FAIL);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FINISH);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_NOT_ENAUGH);    btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(this.printSettingButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FINISH);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_PAUSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FAIL);        bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_NOT_ENAUGH);    btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(this.saveButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_EDIT);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_NEW);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_NEW);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_PAUSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FAIL);        bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FINISH);        bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_NOT_ENAUGH);    btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(this.deleteButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_NEW);    btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(this.exitButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_ALL);    bs.addBillStatus(ZcSettingConstants.BILL_STATUS_ALL);    btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(this.helpButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_ALL);    bs.addBillStatus(ZcSettingConstants.BILL_STATUS_ALL);    btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(this.previousButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);    bs.addBillStatus(ZcSettingConstants.BILL_STATUS_ALL);    btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(this.nextButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);    bs.addBillStatus(ZcSettingConstants.BILL_STATUS_ALL);    btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(selectExpertButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_NEW);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_PAUSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FAIL);        btnStatusList.add(bs);    bs = new ButtonStatus();    bs.setButton(this.pauseEvalExpertButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECTING);    btnStatusList.add(bs);/*    bs = new ButtonStatus();    bs.setButton(this.showInfoButton);    bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_PAUSE);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FAIL);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECTING);    bs.addBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_FINISH);    btnStatusList.add(bs);*/     }  EmExpertSelectionBill obj = (EmExpertSelectionBill) (this.listCursor.getCurrentObject());  String billStatus = obj.getBillStatus();  ZcUtil.setButtonEnable(this.btnStatusList, billStatus, this.pageStatus, this.compoId, obj.getProcessInstId());  //单独处理显示按钮  showInfoButton.setVisible(showBtns);}  private void setSubPanelButton(JFuncToolBar subToolBar) {    if (subToolBar != null) {      if (this.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_EDIT) || this.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_NEW)) {        subToolBar.setEnabled(true);      } else {        subToolBar.setEnabled(false);      }    }  }  private void setDefualtValue(EmExpertSelectionBill bill, String pageStatus) {    if (pageStatus.equals(ZcSettingConstants.PAGE_STATUS_NEW)) {      bill.setInputorId(this.requestMeta.getSvUserName());      bill.setInputorDate(this.requestMeta.getSysDate());      bill.setNd(this.requestMeta.getSvNd());            bill.setExpertBillType("0");    }  }  @Override  protected void updateFieldEditorsEditable() {    super.updateFieldEditors();    if (this.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_NEW) || this.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_EDIT)) {      for (AbstractFieldEditor fd : this.fieldEditors) {/*        if (fd.getFieldName() != null && (fd.getFieldName().equals("inputorDate") || fd.getFieldName().equals("billStatus"))) {                 fd.setEnabled(false);        } else {          fd.setEnabled(true);        }*/      //先放开状态值的修改，用于扬中手工编织,日期也放开        fd.setEnabled(true);      }    } else if (this.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {      for (AbstractFieldEditor fd : this.fieldEditors) {        fd.setEnabled(false);      }    }  }  private void setOldObject() {    this.oldBill = (EmExpertSelectionBill) ObjectUtil.deepCopy(listCursor.getCurrentObject());  }  @Override  public List<AbstractFieldEditor> createFieldEditors() {    List<AbstractFieldEditor> editorList = new ArrayList<AbstractFieldEditor>();    AutoNumFieldEditor billCodeEditor = new AutoNumFieldEditor("抽取登记编码", "billCode");    editorList.add(billCodeEditor);    ZcEmProMakeHandler handler = new ZcEmProMakeHandler() {      @SuppressWarnings("unchecked")      @Override      public void excute(List selectedDatas) {        for (Object obj : selectedDatas) {          EmProMake m = (EmProMake) obj;          currentBill = (EmExpertSelectionBill) listCursor.getCurrentObject();          currentBill.setMakeCode(m.getZcMakeCode());                    currentBill.setCoName(m.getCoName());          currentBill.setCoCode(m.getCoCode());          currentBill.setMakeName(m.getZcMakeName());          currentBill.setZjdwCode(m.getAgency());          currentBill.setZjdwName(m.getAgencyName());          currentBill.setContactCompany(m.getCoName());          currentBill.setContactPerson(m.getZcMakeLinkman());          currentBill.setContactPhone(m.getZcMakeTel());          getAllPackListByProjCode();          getAllExcludeExpertListAuto();          setEditingObject(currentBill);        }      }    };    final ProMakeNewFieldEditor proMakeEditor = new ProMakeNewFieldEditor(handler.getSqlId(), 20, handler, handler.getColumNames(), "项目编码",      "makeCode");    editorList.add(proMakeEditor);    makeNameEditor = new TextFieldEditor("项目名称", "makeName");    editorList.add(makeNameEditor);    linkManEditor = new TextFieldEditor("采购单位", "contactCompany");    editorList.add(linkManEditor);    linkManEditor = new TextFieldEditor("联系人", "contactPerson");    editorList.add(linkManEditor);    telEditor = new TextFieldEditor("联系电话", "contactPhone");    editorList.add(telEditor);    billTypeEditor = new AsValFieldEditor("抽取单类别", "expertBillType", "EM_VS_EXPERT_BILL_TYPE") {      private static final long serialVersionUID = 8416332144320436905L;      protected void afterChange(AsValComboBox field) {        getAllExcludeExpertListAuto();      }    };    editorList.add(billTypeEditor);    AsValFieldEditor cgfsEditor = new AsValFieldEditor("采购方式", "emFs", "ZC_VS_PITEM_OPIWAY");    editorList.add(cgfsEditor);    TextFieldEditor guarderCodeEditor = new TextFieldEditor("监抽人", "guarderCode");    editorList.add(guarderCodeEditor);    billPlaceEditor = new TextFieldEditor("评标地点", "billPlace");    editorList.add(billPlaceEditor);    tendersTimeEditor = new DateFieldEditor("开始时间", "tendersTime", DateFieldEditor.TimeTypeH24, getDefaultSDate(), true, true, true);      //new DateFieldEditor("开始时间", "tendersTime", DateFieldEditor.TimeTypeH24,null,true,true,true);    editorList.add(tendersTimeEditor);    estimateTimeEditor = new FractionDigitsFieldEditor(false, "预计用时(天)", "estimateTime", 1);    editorList.add(estimateTimeEditor);    agencyNameEditor = new TextFieldEditor("代理机构", "zjdwName");//    editorList.add(agencyNameEditor);    TextFieldEditor inputorField= new TextFieldEditor("录入人", "inputorId");    editorList.add(inputorField);    DateFieldEditor inputTimeEditor = new DateFieldEditor("录入日期", "inputorDate");    editorList.add(inputTimeEditor);    AsValFieldEditor statusEditor = new AsValFieldEditor("状态", "billStatus", "EM_VS_BILL_STATUS");    editorList.add(statusEditor);    return editorList;  }  private String getDefaultSDate() {    Date d = this.requestMeta.getSysDate();    return getDefaultSDate(d);  }  private String getDefaultSDate(Date d) {    String sDate = DateUtil.dateToSsString(getDefaultDate(d));    return sDate;  }  private Date getDefaultDate(Date d) {    long t24 = ZcSettingConstants.TIME_MM_PER_DAY;    long t8 = 28800 * 1000;    long dt = 60 * 1000;    return new Date(d.getTime() - (d.getTime() % t24) - t8 + t24 - dt);  }  @SuppressWarnings("unchecked")  private void getAllPackListByProjCode() {    Map<String, String> map = new HashMap<String, String>();    map.put("PROJ_CODE", currentBill.getMakeCode());    List packList = zcEmExpertSelectionServiceDelegate.getAllPackListByProjCode(map, requestMeta);    currentBill.setPackList(packList);    packJTabelPanel.setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmExpertBillPackageToTableMode(currentBill.getPackList()));    resetSubTable();  }  @SuppressWarnings( { "unchecked" })  private void getAllExcludeExpertListAuto() {    if (currentBill.getMakeCode() == null || currentBill.getExpertBillType() == null || "".equals(currentBill.getMakeCode())      || "".equals(currentBill.getExpertBillType())) {      return;    }    Map<String, String> map = new HashMap<String, String>();    map.put("PROJ_CODE", currentBill.getMakeCode());    map.put("EM_EXPERT_BILL_TYPE", currentBill.getExpertBillType());    List<EmExpertBillFilter> eelAtuo = zcEmExpertSelectionServiceDelegate.getAllExcludeExpertListAuto(map, requestMeta);    if (eelAtuo == null || eelAtuo.size() == 0) {      return;    }    List<EmExpertBillFilter> existList = ((BeanTableModel<EmExpertBillFilter>) excludeJTabelPanel.getTable().getModel()).getDataBeanList();    if (existList != null) {      for (EmExpertBillFilter ebf : eelAtuo) {        boolean flag = true;        for (EmExpertBillFilter existEbf : existList) {          if (existEbf.getEmExpert().getEmExpertCode().equals(ebf.getEmExpert().getEmExpertCode())) {            flag = false;            break;          }        }        if (flag) {          existList.add(ebf);        }      }    } else {      existList = eelAtuo;    }    currentBill.setExcludeExpertList(existList);    excludeJTabelPanel.setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmExpertBillFilterToTableMode(currentBill.getExcludeExpertList()));    resetSubTable();  }  public JComponent createSubBillPanel() {    tabPane = new JTabbedPane();    tabPane.addTab("项目分包", initPackJTabelPanel());    tabPane.addTab("抽取条件", initSelectionConditionPanel());    tabPane.addTab("呼叫信息", initCallInfoPanel());        tabPane.addTab("抽取结果", initResultJTabelPanel());     tabPane.addTab("呼叫记录", initCallRecordsJTabelPanel());    return tabPane;  }private Component initResultJTabelPanel() {    // TODO Auto-generated method stub    //扬中先手工使用，给领导看一下，过关使用，先屏蔽掉，抽取结果改为手工插入记录    resultJTabelPanel.init();  resultJTabelPanel.setEnabled(false);  resultJTabelPanel.setTablePreferencesKey("expert_resultJTabelPanel");      JButton addBtnEsc = new JButton("添加");  JButton insertBtnEsc = new JButton("插入");  JButton delBtnEsc = new JButton("删除");  selectedExpertBtnBar.add(addBtnEsc);  selectedExpertBtnBar.add(insertBtnEsc);  selectedExpertBtnBar.add(delBtnEsc);    resultJTabelPanel.add(selectedExpertBtnBar, BorderLayout.SOUTH);    selectedExpertBtnBar.setVisible(showBtns);  addBtnEsc.addActionListener(new ActionListener() {    public void actionPerformed(ActionEvent e) {      if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {        JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);        return;      }      EmExpertEvaluation ec = new EmExpertEvaluation();            EmExpert expert=new EmExpert();      ec.setTempId(Guid.genID());      ec.setEmExpert(expert);            ec.setEmBillCode(currentBill.getBillCode());      int rowNum = addSub(resultJTabelPanel, ec);      resultJTabelPanel.getTable().setRowSelectionInterval(rowNum, rowNum);    }  });  insertBtnEsc.addActionListener(new ActionListener() {    public void actionPerformed(ActionEvent e) {      if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {        JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);        return;      }      EmExpertEvaluation ec = new EmExpertEvaluation();            EmExpert expert=new EmExpert();      ec.setTempId(Guid.genID());      ec.setEmExpert(expert);            ec.setEmBillCode(currentBill.getBillCode());      int rowNum = insertSub(resultJTabelPanel, ec);      resultJTabelPanel.getTable().setRowSelectionInterval(rowNum, rowNum);    }  });  delBtnEsc.addActionListener(new ActionListener() {    public void actionPerformed(ActionEvent e) {      if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {        JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);        return;      }      deleteSub(resultJTabelPanel);    }  });    return resultJTabelPanel;  }  //初始化呼叫记录面板  private Component initCallRecordsJTabelPanel() {    // TODO Auto-generated method stub    callRecordsJTabelPanel.init();    callRecordsJTabelPanel.setEnabled(false);    callRecordsJTabelPanel.setTablePreferencesKey("crJTabelPanel");        JButton addBtnEsc = new JButton("添加");    JButton insertBtnEsc = new JButton("插入");    JButton delBtnEsc = new JButton("删除");////    callRecordsToolbar.add(addBtnEsc);////    callRecordsToolbar.add(insertBtnEsc);    callRecordsToolbar.add(delBtnEsc);    callRecordsJTabelPanel.add(callRecordsToolbar, BorderLayout.SOUTH);        callRecordsToolbar.setVisible(showBtns);    addBtnEsc.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {          JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);          return;        }        EmCallExpertRecord ec = new EmCallExpertRecord();                EmExpert expert=new EmExpert();        ec.setTempId(Guid.genID());        ec.setEmExpert(expert);                ec.setCallTime(requestMeta.getSysDate());        ec.setEmBillCode(currentBill.getBillCode());        int rowNum = addSub(callRecordsJTabelPanel, ec);        callRecordsJTabelPanel.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    insertBtnEsc.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {          JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);          return;        }        EmCallExpertRecord ec = new EmCallExpertRecord();                EmExpert expert=new EmExpert();        ec.setTempId(Guid.genID());        ec.setEmExpert(expert);                ec.setCallTime(requestMeta.getSysDate());        ec.setEmBillCode(currentBill.getBillCode());        int rowNum = insertSub(callRecordsJTabelPanel, ec);        callRecordsJTabelPanel.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    delBtnEsc.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {          JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);          return;        }        deleteSub(callRecordsJTabelPanel);      }    });        return callRecordsJTabelPanel;  }  private JTablePanel initPackJTabelPanel() {    packJTabelPanel.init();    packJTabelPanel.setTablePreferencesKey("expert_PackJTabelPanel");    this.ppcToolBarPpc = new JFuncToolBar();    JButton delBtnPpc = new JButton("删除");    ppcToolBarPpc.add(delBtnPpc);    packJTabelPanel.add(ppcToolBarPpc, BorderLayout.SOUTH);    delBtnPpc.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {          JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);          return;        }        deleteSub(packJTabelPanel);      }    });    return packJTabelPanel;  }  private JSplitPane initSelectionConditionPanel() {    conditionJTabelPanel.init();    conditionJTabelPanel.setTablePreferencesKey("expert_conditonJTabelPanel");    this.escToolBarEsc = new JFuncToolBar();    JButton addBtnEsc = new JButton("添加");    JButton insertBtnEsc = new JButton("插入");    JButton delBtnEsc = new JButton("删除");    escToolBarEsc.add(addBtnEsc);    escToolBarEsc.add(insertBtnEsc);    escToolBarEsc.add(delBtnEsc);    conditionJTabelPanel.add(escToolBarEsc, BorderLayout.SOUTH);    addBtnEsc.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {          JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);          return;        }        EmEvaluationCondition ec = new EmEvaluationCondition();        ec.setTempId(Guid.genID());        ec.setEmExpertType(new EmExpertType());        ec.setEmBillCode(currentBill.getBillCode());        ec.setEmYear(currentBill.getYear());        int rowNum = addSub(conditionJTabelPanel, ec);        conditionJTabelPanel.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    insertBtnEsc.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {          JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);          return;        }        EmEvaluationCondition ec = new EmEvaluationCondition();        ec.setTempId(Guid.genID());        ec.setEmExpertType(new EmExpertType());        ec.setEmBillCode(currentBill.getBillCode());        ec.setEmYear(currentBill.getYear());        int rowNum = insertSub(conditionJTabelPanel, ec);        conditionJTabelPanel.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    delBtnEsc.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {          JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);          return;        }        deleteSub(conditionJTabelPanel);      }    });    excludeJTabelPanel.init();    excludeJTabelPanel.setTablePreferencesKey("eelJTabelPanel");    this.eelToolBarEel = new JFuncToolBar();    JButton addBtnEel = new JButton("添加");    JButton insertBtnEel = new JButton("插入");    JButton delBtnEel = new JButton("删除");    eelToolBarEel.add(addBtnEel);    eelToolBarEel.add(insertBtnEel);    eelToolBarEel.add(delBtnEel);    excludeJTabelPanel.add(eelToolBarEel, BorderLayout.SOUTH);    addBtnEel.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {          JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);          return;        }        EmExpertBillFilter ebf = new EmExpertBillFilter();        ebf.setTempId(Guid.genID());        ebf.setEmExpert(new EmExpert());        ebf.setEmBillCode(currentBill.getBillCode());        int rowNum = addSub(excludeJTabelPanel, ebf);        excludeJTabelPanel.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    insertBtnEel.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {          JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);          return;        }        EmExpertBillFilter ebf = new EmExpertBillFilter();        ebf.setTempId(Guid.genID());        ebf.setEmExpert(new EmExpert());        ebf.setEmBillCode(currentBill.getBillCode());        int rowNum = insertSub(excludeJTabelPanel, ebf);        excludeJTabelPanel.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    delBtnEel.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        if (self.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {          JOptionPane.showMessageDialog(self, "请点击\"修改\"按钮切换至可编辑状态！", "提示", JOptionPane.INFORMATION_MESSAGE);          return;        }        deleteSub(excludeJTabelPanel);      }    });    JTabbedPane escJTabbedPane = new JTabbedPane();    escJTabbedPane.add("抽取专家类型和人数", conditionJTabelPanel);    JTabbedPane eelJTabbedPane = new JTabbedPane();    eelJTabbedPane.add("屏蔽专家", excludeJTabelPanel);    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);    splitPane.setLeftComponent(escJTabbedPane);    splitPane.setRightComponent(eelJTabbedPane);    int width = (int) ((Toolkit.getDefaultToolkit().getScreenSize().width - splitPane.getDividerSize()) * 0.35);    splitPane.setDividerLocation(width);    splitPane.setBackground(self.getBackground());    return splitPane;  }  private JSplitPane initCallInfoPanel() {    JSplitPane ciPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);    //left panel    JPanel leftPanel = new JPanel(new BorderLayout());    this.callInfoBar = new JFuncToolBar();    JButton callBtn = new JButton("生成语音信息");    callBtn.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));    callInfoBar.add(callBtn);    leftPanel.add(callInfoBar, BorderLayout.NORTH);    leftPanel.add(callInfoArea);    ciPanel.setLeftComponent(leftPanel);    //right panel    JPanel rightPanel = new JPanel(new BorderLayout());    this.msgInfoBar = new JFuncToolBar();    JButton msgBtn = new JButton("生成短信信息");    msgBtn.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));    msgInfoBar.add(msgBtn);    rightPanel.add(msgInfoBar, BorderLayout.NORTH);    rightPanel.add(msgInfoArea);    ciPanel.setRightComponent(rightPanel);    int width = (int) ((Toolkit.getDefaultToolkit().getScreenSize().width - ciPanel.getDividerSize()) * 0.35);    ciPanel.setDividerLocation(width);    //    ciPanel.setOneTouchExpandable(true);    //    ciPanel.setContinuousLayout(true);    ciPanel.setBackground(self.getBackground());    ciPanel.setOpaque(true);    ciPanel.setOneTouchExpandable(true);    callBtn.addActionListener(new ActionListener() {      @Override      public void actionPerformed(ActionEvent e) {        String callInfo = createCallInfo();        callInfoArea.setText(callInfo);      }    });    msgBtn.addActionListener(new ActionListener() {      @Override      public void actionPerformed(ActionEvent e) {        String msgInfo = createMsgInfo();        currentBill.setMsgInfo(msgInfo);        msgInfoArea.setText(msgInfo);      }    });    return ciPanel;  }  private String createCallInfo() {    if (!checkBeforeSave(false)) {      return "";    }    SimpleDateFormat sdf = new SimpleDateFormat("yyyy年M月d日H时m分");    String defultStr = LangTransMeta.translate("ZC_EB_CALL_INFO");    defultStr = defultStr.replace("【日期】", sdf.format(tendersTimeEditor.getValue()).toString().trim());    defultStr = defultStr.replace("【代理机构】", agencyNameEditor.getValue().toString().trim());    defultStr = defultStr.replace("【地点】", billPlaceEditor.getValue().toString().trim());    defultStr = defultStr.replace("【项目名称】", makeNameEditor.getValue().toString().trim());    defultStr = defultStr.replace("【类别】", ((AsVal) billTypeEditor.getValue()).getVal().trim());    NumberFormat nf = NumberFormat.getInstance();    nf.setMaximumFractionDigits(1);    String estimateTime = nf.format(Double.parseDouble(estimateTimeEditor.getValue().toString().trim()));    defultStr = defultStr.replace("【预计工时】", estimateTime);    defultStr = defultStr.replace("【联系人姓名】", linkManEditor.getValue().toString().trim());    defultStr = defultStr.replace("【联系电话】", telEditor.getValue().toString().trim());    return defultStr.trim();  }  private String createMsgInfo() {    if (!checkBeforeSave(false)) {      return "";    }    SimpleDateFormat sdf = new SimpleDateFormat("yyyy年M月d日H时m分");    String defultStr = LangTransMeta.translate("ZC_EB_MSG_INFO");    defultStr = defultStr.replace("【日期】", sdf.format(tendersTimeEditor.getValue()).toString().trim());    defultStr = defultStr.replace("【代理机构】", agencyNameEditor.getValue().toString().trim());    defultStr = defultStr.replace("【地点】", billPlaceEditor.getValue().toString().trim());    defultStr = defultStr.replace("【项目名称】", makeNameEditor.getValue().toString().trim());    defultStr = defultStr.replace("【类别】", ((AsVal) billTypeEditor.getValue()).getVal().trim());    NumberFormat nf = NumberFormat.getInstance();    nf.setMaximumFractionDigits(1);    String estimateTime = nf.format(Double.parseDouble(estimateTimeEditor.getValue().toString().trim()));    defultStr = defultStr.replace("【预计工时】", estimateTime);    defultStr = defultStr.replace("【联系人姓名】", linkManEditor.getValue().toString().trim());    defultStr = defultStr.replace("【联系电话】", telEditor.getValue().toString().trim());    return defultStr.trim();  }  @Override  public void initToolBar(JFuncToolBar toolBar) {    toolBar.setModuleCode("ZC");    toolBar.setCompoId(compoId);    toolBar.add(addButton);    toolBar.add(editButton);    toolBar.add(saveButton);    toolBar.add(deleteButton);    toolBar.add(sendButton);//送审    toolBar.add(suggestPassButton);//填写意见审核通过    toolBar.add(callbackButton);//收回    toolBar.add(unTreadButton);//退回    toolBar.add(unAuditButton);//销审    toolBar.add(traceButton);//跟踪    toolBar.add(selectExpertButton);    toolBar.add(pauseEvalExpertButton);    toolBar.add(showInfoButton);    toolBar.add(previousButton);    toolBar.add(nextButton);    toolBar.add(printButton);    toolBar.add(printPreviewButton);    toolBar.add(printSettingButton);    toolBar.add(exitButton);    toolBar.add(helpButton);    addButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doAdd();      }    });    editButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doEdit();      }    });    deleteButton.addActionListener(new ActionListener() {      @Override      public void actionPerformed(ActionEvent e) {        doDelete();      }    });    sendButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doSend();      }    });    suggestPassButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doSuggestPass();      }    });    callbackButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doCallback();      }    });    unTreadButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doUntread();      }    });    unAuditButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doUnaudit();      }    });    traceButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doTrace();      }    });    saveButton.addActionListener(new ActionListener() {      @Override      public void actionPerformed(ActionEvent e) {        doSave();      }    });    previousButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doPrevious();      }    });    nextButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doNext();      }    });    exitButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doExit();      }    });    printButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doPrint();      }    });    printPreviewButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doPrintPreview();      }    });    printSettingButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doPrintSetting();      }    });    helpButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doHelp();      }    });    selectExpertButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {                //在没有硬件设备（语音卡等）时，为了模拟抽取专家，设置这个开关，放开时，后台模拟抽取专家，前台可以展示        //ZC_OPT_EXPERT_FAKE_SELECT  Y/N Y:模拟抽取；N:正常抽取        //注意这个方法样放在上一个方法doSelectExperts()的后面，因为执行上一个方法后，单据状态变了，后一个方法才有效         if("Y".equalsIgnoreCase(AsOptionMeta.getOptVal("ZC_OPT_EXPERT_FAKE_SELECT"))){          doSelectExpertsFake();        }else{          doSelectExperts();         }      }    });    pauseEvalExpertButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doPauseEvalExpertButton();      }    });    showInfoButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doShowInfo();      }    });  }  protected void doSelectExpertsFake() {    // TODO Auto-generated method stub    //在没有硬件设备（语音卡等）时，为了模拟抽取专家，设置这个开关，放开时，后台模拟抽取专家，前台可以展示    //ZC_OPT_EXPERT_FAKE_SELECT  Y/N Y:模拟抽取；N:正常抽取    if("Y".equalsIgnoreCase(AsOptionMeta.getOptVal("ZC_OPT_EXPERT_FAKE_SELECT"))){      currentBill=zcEmExpertSelectionServiceDelegate.fakeSelectExperts(currentBill,requestMeta);         listCursor.setCurrentObject(currentBill);            this.listPanel.refreshCurrentTabData();            refreshData();                 if (EmExpertSelectionBill.BILL_STATUS_SELECT_FAIL.equals(currentBill.getBillStatus()) ||EmExpertSelectionBill.BILL_STATUS_SELECT_NOT_ENAUGH.equals(currentBill.getBillStatus())) {        //抽取结束,但是抽取到的专家个数小于实际需求数量               completeButNotSucess();        showCompleteAndNotAccordMsg();      } else if (EmExpertSelectionBill.BILL_STATUS_SELECT_FINISH.equals(currentBill.getBillStatus()) && isCompleteEval()) {               // 显示抽取结果        showCompleteMsg();                    }    }      }  private void refreshAll(EmExpertSelectionBill afterSaveBill, boolean isRefreshButton) {    this.listCursor.setCurrentObject(afterSaveBill);    refreshData();    if (isRefreshButton) {      setButtonStatus(afterSaveBill, requestMeta, this.listCursor);    }  }  /*   * 流程跟踪   */  private void doTrace() {    ZcBaseBill bean = (ZcBaseBill) this.listCursor.getCurrentObject();    if (bean == null) {      return;    }    ZcUtil.showTraceDialog(bean, compoId);  }  /*   * 销审   */  private void doUnaudit() {    boolean success = true;    EmExpertSelectionBill afterSaveBill = null;    String errorInfo = "";    try {      requestMeta.setFuncId(unAuditButton.getFuncId());      EmExpertSelectionBill bill = (EmExpertSelectionBill) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());      bill.setAuditorId(WorkEnv.getInstance().getCurrUserId());      afterSaveBill = listPanel.getZcEmExpertSelectionServiceDelegate().unAuditFN(bill, requestMeta);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshAll(afterSaveBill, true);      JOptionPane.showMessageDialog(this, "销审成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "销审失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  /*   * 退回   */  private void doUntread() {    if (checkBeforeSave()) {      return;    }    if (isDataChanged()) {      JOptionPane.showMessageDialog(this, "数据发生改变，请先保存.", "提示", JOptionPane.INFORMATION_MESSAGE);      return;    }    GkCommentUntreadDialog commentDialog = new GkCommentUntreadDialog(DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(),      ModalityType.APPLICATION_MODAL);    if (commentDialog.cancel) {      return;    }    boolean success = true;    EmExpertSelectionBill afterSaveBill = null;    String errorInfo = "";    try {      requestMeta.setFuncId(unTreadButton.getFuncId());      EmExpertSelectionBill bill = (EmExpertSelectionBill) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());      bill.setAuditorId(WorkEnv.getInstance().getCurrUserId());      bill.setComment(commentDialog.getComment());      afterSaveBill = listPanel.getZcEmExpertSelectionServiceDelegate().untreadFN(bill, requestMeta);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshAll(afterSaveBill, true);      JOptionPane.showMessageDialog(this, "退回成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "退回失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  /*   * 收回   */  private void doCallback() {    boolean success = true;    EmExpertSelectionBill afterSaveBill = null;    String errorInfo = "";    try {      requestMeta.setFuncId(this.callbackButton.getFuncId());      EmExpertSelectionBill bill = (EmExpertSelectionBill) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());      bill.setAuditorId(WorkEnv.getInstance().getCurrUserId());      afterSaveBill = listPanel.getZcEmExpertSelectionServiceDelegate().callbackFN(bill, requestMeta);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshAll(afterSaveBill, true);      JOptionPane.showMessageDialog(this, "收回成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "收回失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  /**   * 保存前校验   * @param cpApply   * @return   */  private boolean checkBeforeSave() {    List mainNotNullList = ((BillElementMeta) this.listPanel.getBillElementMeta()).getNotNullBillElement();    EmExpertSelectionBill emExpertSelectionBill = (EmExpertSelectionBill) this.listCursor.getCurrentObject();    StringBuilder errorInfo = new StringBuilder();    String mainValidateInfo = ZcUtil.validateBillElementNull(emExpertSelectionBill, mainNotNullList);    if (mainValidateInfo.length() != 0) {      errorInfo.append(LangTransMeta.translate(TITLE_TRANS_EM_EXPERT_PRO_BILL)).append("：\n").append(mainValidateInfo.toString()).append("\n");    }    //ZcPProMake beanData = (ZcPProMake) this.listCursor.getCurrentObject();    //beanData.setZcMoneyBiSum(sum);    if (errorInfo.length() != 0) {      JOptionPane.showMessageDialog(this, errorInfo.toString(), "提示", JOptionPane.WARNING_MESSAGE);      return true;    }    return false;  }  /*   * 送审   */  private void doSend() {    boolean success = true;    EmExpertSelectionBill afterSaveBill = null;    String errorInfo = "";    if (checkBeforeSave()) {      return;    }    GkCommentDialog commentDialog = new GkCommentDialog(DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(),      ModalityType.APPLICATION_MODAL);    if (commentDialog.cancel) {      return;    }    try {      requestMeta.setFuncId(this.sendButton.getFuncId());      EmExpertSelectionBill bill = (EmExpertSelectionBill) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());      bill.setAuditorId(WorkEnv.getInstance().getCurrUserId());      bill.setComment(commentDialog.getComment());      afterSaveBill = this.listPanel.getZcEmExpertSelectionServiceDelegate().newCommitFN(bill, false, requestMeta);    } catch (Exception ex) {      errorInfo += ex.getMessage();      logger.error(ex.getMessage(), ex);      success = false;      UIUtilities.showStaickTraceDialog(ex, this, "错误", ex.getMessage());    }    if (success) {      this.refreshAll(afterSaveBill, true);      JOptionPane.showMessageDialog(this, "送审成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();    }  }  /*   * 填写意见审核   */  private void doSuggestPass() {    if (checkBeforeSave()) {      return;    }    if (isDataChanged()) {      JOptionPane.showMessageDialog(this, "数据发生改变，请先保存.", "提示", JOptionPane.INFORMATION_MESSAGE);      return;    }    GkCommentDialog commentDialog = new GkCommentDialog(DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(),      ModalityType.APPLICATION_MODAL);    if (commentDialog.cancel) {      return;    }    boolean success = true;    EmExpertSelectionBill afterSaveBill = null;    String errorInfo = "";    try {      requestMeta.setFuncId(this.suggestPassButton.getFuncId());      EmExpertSelectionBill bill = (EmExpertSelectionBill) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());      bill.setComment(commentDialog.getComment());      bill.setAuditorId(WorkEnv.getInstance().getCurrUserId());      afterSaveBill = listPanel.getZcEmExpertSelectionServiceDelegate().auditFN(bill, requestMeta);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshAll(afterSaveBill, true);      JOptionPane.showMessageDialog(this, "审核成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "审核失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  private void doShowInfo() {    paramMap.put("EM_BILL_CODE", currentBill.getBillCode());    if (showExpertInfo) {      showInfoButton.setText("显示");      showExpertInfo = false;    } else {      showInfoButton.setText("隐藏");      showExpertInfo = true;    }   /* refreshEelAndCrlSubTablePaneData();    createThreadRefreshEelAndCrlSubTablePane();*/    refreshSubTableData(currentBill);        translateSubTableColumn();        setSubTableCellEditor();        updateFieldEditorsEditable();    setButtonStatus();  }  private void doPrint() {    if ((this.currentBill == null) || (this.currentBill.getExpertEvaluationList().size() == 0)) {      JOptionPane.showMessageDialog(this, "请选择需要打印的数据 ！", "提示", 1);      return;    }    this.requestMeta.setFuncId(this.printButton.getFuncId());    this.requestMeta.setPageType(this.compoId + "_L");    boolean success = true;    boolean printed = false;    try {      PrintObject printObject = this.zcEmExpertSelectionServiceDelegate.genEmExpertEvaluationPrintObject(this.currentBill, this.requestMeta);      if (Printer.print(printObject))        printed = true;    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      JOptionPane.showMessageDialog(this, "打印出错！\n" + e.getMessage(), "错误", 0);    }    if (!success) {      return;    }  }  private void doPrintPreview() {    List printList = this.currentBill.getExpertEvaluationList();    if (printList.size() == 0) {      JOptionPane.showMessageDialog(this, "请选择需要打印预览的数据 ！", "提示", 1);      return;    }    this.requestMeta.setFuncId(this.printPreviewButton.getFuncId());    this.requestMeta.setPageType(this.compoId + "_L");    try {      PrintObject printObject = this.zcEmExpertSelectionServiceDelegate.genEmExpertEvaluationPrintObject(this.currentBill, this.requestMeta);      PrintPreviewer previewer = new PrintPreviewer(printObject) {        private static final long serialVersionUID = -2062795877986561088L;        protected void afterSuccessPrint() {        }      };      previewer.preview();    } catch (Exception e) {      logger.error(e.getMessage(), e);      JOptionPane.showMessageDialog(this, "打印预览出错！\n" + e.getMessage(), "错误", 0);    }  }  private void doPrintSetting() {    this.requestMeta.setFuncId(this.printSettingButton.getFuncId());    this.requestMeta.setPageType(this.compoId + "_L");    new PrintSettingDialog(this.requestMeta);  }  @SuppressWarnings("unchecked")  private void refreshEelAndCrlSubTablePane() {//    System.out.println("beging--refresh-----windows-----");    resultJTabelPanel      .setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmExpertEvaluationToTableMode(currentBill.getExpertEvaluationList(),showExpertInfo));    callRecordsJTabelPanel.setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmCallExpertRecordToTableMode(currentBill.getCallExpertRecordList(),showExpertInfo));    resetSubTable();    // 必须要repaint一下，否则的话有时候显示不正确    resultJTabelPanel.repaint();    callRecordsJTabelPanel.repaint();//    System.out.println("end--refresh-----windows-----");  }  @SuppressWarnings("unchecked")  private void rereshfEelAndCrlSubTablePaneData() {    Map<String, String> map = new HashMap<String, String>();    map.put("EM_BILL_CODE", currentBill.getBillCode());    currentBill = zcEmExpertSelectionServiceDelegate.getModel(map, requestMeta);    List expertEvaluationList = zcEmExpertSelectionServiceDelegate.getExpertEvaluationList(paramMap, requestMeta);    currentBill.setExpertEvaluationList(expertEvaluationList);    List callExpertRecordList = zcEmExpertSelectionServiceDelegate.getCallExpertRecordList(paramMap, requestMeta);    currentBill.setCallExpertRecordList(callExpertRecordList);    currentBill.setDbDigest(currentBill.digest());    listCursor.setCurrentObject(currentBill);    setEditingObject(currentBill);    setButtonStatus();  }  private void refreshEelAndCrlSubTablePaneData() {    //    SwingUtilities.invokeLater(new Runnable() {    //      @Override    //      public void run() {    //        getSelectExpertAndCallRecordDatas();    //      }    //    });    getSelectExpertAndCallRecordDatas();  }  private void getSelectExpertAndCallRecordDatas() {//    System.out.println("beging++get+++data++++");    List expertEvaluationList = this.zcEmExpertSelectionServiceDelegate.getExpertEvaluationList(this.paramMap, this.requestMeta);    this.currentBill.setExpertEvaluationList(expertEvaluationList);    List callExpertRecordList = this.zcEmExpertSelectionServiceDelegate.getCallExpertRecordList(this.paramMap, this.requestMeta);    this.currentBill.setCallExpertRecordList(callExpertRecordList);    this.currentBill.setDbDigest(this.currentBill.digest());//    System.out.println("end++get+++data++++");  }  private void createThreadRefreshEelAndCrlSubTablePane() {    //    SwingUtilities.invokeLater(new Runnable() {    //      @Override    //      public void run() {    //        refreshEelAndCrlSubTablePane();    //      }    //    });    refreshEelAndCrlSubTablePane();  }  @SuppressWarnings("unchecked")  private void doPauseEvalExpertButton() {    Map<String, String> m = new HashMap<String, String>();    m.put("EM_BILL_CODE", currentBill.getBillCode());    m.put("EM_STATUS", "6");    zcEmExpertSelectionServiceDelegate.updateBillServerFN(m, this.requestMeta);    currentBill.setBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECT_PAUSE);    //currentBill = zcEmExpertSelectionServiceDelegate.save(this.currentBill, this.requestMeta);    zcEmExpertSelectionServiceDelegate.updateBillStatusFN(currentBill, this.requestMeta);    listCursor.setCurrentObject(currentBill);    this.listPanel.refreshCurrentTabData();    setOldObject();    updateFieldEditorsEditable();    setButtonStatus();    refreshEelAndCrlSubTablePaneData();  }  @SuppressWarnings("unchecked")  private void doSelectExperts() {    Map<String, String> m = new HashMap<String, String>();    m.put("EM_BILL_CODE", currentBill.getBillCode());    m.put("EM_STATUS", "0");    zcEmExpertSelectionServiceDelegate.updateBillServerFN(m, this.requestMeta);    currentBill.setBillStatus(EmExpertSelectionBill.BILL_STATUS_SELECTING);    zcEmExpertSelectionServiceDelegate.updateBillStatusFN(currentBill, this.requestMeta);    //currentBill = this.zcEmExpertSelectionServiceDelegate.save(this.currentBill, this.requestMeta);    listCursor.setCurrentObject(currentBill);    this.listPanel.refreshCurrentTabData();    createThreadRefreshEelAndCrlSubTable();           setOldObject();    updateFieldEditorsEditable();    setButtonStatus();  }  @SuppressWarnings("unchecked")  private void doAdd() {    this.pageStatus = ZcSettingConstants.PAGE_STATUS_NEW;    currentBill = null;    paramMap = new HashMap();    listCursor.setCurrentObject(null);    refreshData();    setOldObject();    updateFieldEditorsEditable();    setButtonStatus();  }  private void doEdit() {    this.pageStatus = ZcSettingConstants.PAGE_STATUS_EDIT;    updateFieldEditorsEditable();    setButtonStatus();  }  private void doDelete() {    EmExpertSelectionBill bill = (EmExpertSelectionBill) this.listCursor.getCurrentObject();    int num = JOptionPane.showConfirmDialog(this, "确认删除当前数据？", "删除确认", 0);    if (num == JOptionPane.YES_OPTION) {      boolean success = true;      String errorInfo = "";      try {        Map<String, String> m = new HashMap<String, String>();        m.put("EM_BILL_CODE", bill.getBillCode());        zcEmExpertSelectionServiceDelegate.deleteFN(m, this.requestMeta);      } catch (Exception e) {        logger.error(e.getMessage(), e);        success = false;        errorInfo += e.getMessage();      }      if (success) {        JOptionPane.showMessageDialog(self, "删除成功！", "提示", JOptionPane.INFORMATION_MESSAGE);        this.pageStatus = ZcSettingConstants.PAGE_STATUS_BROWSE;        this.listCursor.removeCurrentObject();        refreshData();        if (this.forenEntityDialog == null) {          this.listPanel.refreshCurrentTabData();        } else {          refreshParentForeignDialog(null);        }        updateFieldEditorsEditable();        setButtonStatus();      } else {        JOptionPane.showMessageDialog(this, "删除失败 ！\n" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);      }    }  }  @SuppressWarnings("unchecked")  private void doPrevious() {    stopTableEditing();    if (isDataChanged()) {      int num = JOptionPane.showConfirmDialog(this, "当前页面数据已修改，是否要保存", "保存确认", 0);      if (num == JOptionPane.YES_OPTION) {        if (!doSave()) {          return;        }      } else {        listCursor.setCurrentObject(this.oldBill);      }    }    listCursor.previous();    refreshData();    setButtonStatus();  }  @SuppressWarnings("unchecked")  private void doNext() {    stopTableEditing();    if (isDataChanged()) {      int num = JOptionPane.showConfirmDialog(this, "当前页面数据已修改，是否要保存", "保存确认", 0);      if (num == JOptionPane.YES_OPTION) {        if (!doSave()) {          return;        }      } else {        listCursor.setCurrentObject(this.oldBill);      }    }    listCursor.next();    refreshData();    setButtonStatus();  }  public void doExit() {    stopTableEditing();    if (timer != null) {      timer.cancel();      System.gc();    }        if (isDataChanged()) {      int num = JOptionPane.showConfirmDialog(this, "当前页面数据已修改，是否要保存", "保存确认", 0);      if (num == JOptionPane.YES_OPTION) {        if (!doSave()) {          return;        }      }    }    this.parent.dispose();  }  @SuppressWarnings("unchecked")  public boolean doSave() {    if (!checkBeforeSave(true)) {      return false;    }    boolean success = true;    String errorInfo = "";    try {      currentBill.setCallInfo(callInfoArea.getText() + "同意请按1，不同意请按2，重新收听请按0。");      currentBill.setMsgInfo(msgInfoArea.getText());      currentBill = zcEmExpertSelectionServiceDelegate.saveFN(currentBill, requestMeta);      //createThreadRefreshEelAndCrlSubTable();    } catch (Exception e) {      logger.error(e.getMessage(), e);      success = false;      errorInfo += e.getMessage();    }    if (success) {      this.listCursor.setCurrentObject(currentBill);      paramMap.put("EM_BILL_CODE", currentBill.getBillCode());      this.listPanel.refreshCurrentTabData();      JOptionPane.showMessageDialog(self, "保存成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.pageStatus = ZcSettingConstants.PAGE_STATUS_BROWSE;      updateFieldEditorsEditable();      setButtonStatus();      setOldObject();      return true;    } else {      JOptionPane.showMessageDialog(this, "保存失败 ！\n" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);      return false;    }  }  @SuppressWarnings("unchecked")  private boolean checkBeforeSave(boolean saveCheck) {    List notNullBillElementList = this.billElementMeta.getNotNullBillElement();    EmExpertSelectionBill bill = (EmExpertSelectionBill) this.listCursor.getCurrentObject();    StringBuilder errorInfo = new StringBuilder();    String validateInfo = ZcUtil.validateBillElementNull(bill, notNullBillElementList);    if (validateInfo.length() != 0) {      errorInfo.append("").append(validateInfo.toString());    }    if (saveCheck) {      if ("60701".equals(currentBill.getZjdwCode())) {        if (currentBill.getPackList() == null || currentBill.getPackList().size() == 0) {          errorInfo.append("请指定项目分包！").append("\n");        }      }      if (callInfoArea.getText() == null || "".equals(callInfoArea.getText().trim())) {        errorInfo.append("语言信息不能为空！").append("\n");      }      if (msgInfoArea.getText() == null || "".equals(msgInfoArea.getText().trim())) {        errorInfo.append("短信信息不能为空！").append("\n");      }      removeBlankRowInEscJTabelPanel();      if (currentBill.getExpertEvalConditionList() == null || currentBill.getExpertEvalConditionList().size() == 0) {        errorInfo.append("请指定抽取专家类别和人数！").append("\n");      } else {        Iterator<EmEvaluationCondition> it = currentBill.getExpertEvalConditionList().iterator();        while (it.hasNext()) {          EmEvaluationCondition eec = it.next();          if (eec.getExpertNum() == null) {            errorInfo.append("请指定抽取专家人数！").append("\n");            break;          } else if (eec.getEmExpertType() == null) {            errorInfo.append("请指定抽取专家类别！").append("\n");            break;          }        }      }      boolean flag = isHasRepeatRowsInEscJTabelPanel();      if (flag) {        errorInfo.append("指定的抽取专家类别和人数存在重复行！").append("\n");      }      removeBlankRowInEelJTabelPanel();      flag = isHasRepeatRowsInEslJTabelPanel();      if (flag) {        errorInfo.append("指定的屏蔽专家存在重复行！").append("\n");      }    }    if (errorInfo.length() != 0) {      JOptionPane.showMessageDialog(this.parent, errorInfo.toString(), "提示", JOptionPane.WARNING_MESSAGE);      return false;    }    return true;  }  @SuppressWarnings("unchecked")  public void removeBlankRowInEscJTabelPanel() {    List<EmEvaluationCondition> existList = ((BeanTableModel<EmEvaluationCondition>) conditionJTabelPanel.getTable().getModel()).getDataBeanList();    if (existList == null || existList.size() == 0) {      return;    }    List<EmEvaluationCondition> noBlankRowList = new ArrayList<EmEvaluationCondition>();    for (EmEvaluationCondition esc : existList) {      if (esc.getExpertNum() == null        && (esc.getEmExpertType() == null || esc.getEmExpertType().getEmTypeCode() == null || "".equals(esc.getEmExpertType().getEmTypeCode().trim()))) {        continue;      }      noBlankRowList.add(esc);    }    currentBill.setExpertEvalConditionList(noBlankRowList);    conditionJTabelPanel.setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmEvaluationConditionToTableMode(currentBill      .getExpertEvalConditionList()));    resetSubTable();  }  @SuppressWarnings("unchecked")  public void removeBlankRowInEelJTabelPanel() {    List<EmExpertBillFilter> existList = ((BeanTableModel<EmExpertBillFilter>) excludeJTabelPanel.getTable().getModel()).getDataBeanList();    if (existList == null || existList.size() == 0) {      return;    }    List<EmExpertBillFilter> noBlankRowList = new ArrayList<EmExpertBillFilter>();    for (EmExpertBillFilter eel : existList) {      if (eel.getEmExpert() == null || eel.getEmExpert().getEmExpertCode() == null || "".equals(eel.getEmExpert().getEmExpertCode().trim())) {        existList.remove(eel);        continue;      }      noBlankRowList.add(eel);    }    currentBill.setExcludeExpertList(noBlankRowList);    excludeJTabelPanel.setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmExpertBillFilterToTableMode(currentBill.getExcludeExpertList()));    resetSubTable();  }  @SuppressWarnings("unchecked")  public boolean isHasRepeatRowsInEscJTabelPanel() {    if (currentBill.getExpertEvalConditionList() == null) {      return false;    }    Set<String> set = new HashSet<String>();    Iterator it = currentBill.getExpertEvalConditionList().iterator();    while (it.hasNext()) {      EmEvaluationCondition eec = (EmEvaluationCondition) it.next();      String key = eec.getEmExpertType().getEmTypeCode();      if (!set.contains(key)) {        set.add(key);      } else {        return true;      }    }    return false;  }  @SuppressWarnings("unchecked")  public boolean isHasRepeatRowsInEslJTabelPanel() {    if (currentBill.getExcludeExpertList() == null) {      return false;    }    Set<String> set = new HashSet<String>();    Iterator it = currentBill.getExcludeExpertList().iterator();    while (it.hasNext()) {      EmExpertBillFilter ebf = (EmExpertBillFilter) it.next();      String key = ebf.getEmExpert().getEmExpertCode();      if (!set.contains(key)) {        set.add(key);      } else {        return true;      }    }    return false;  }  @SuppressWarnings("unchecked")  public void refreshExpertEvalConditionListTable() {    ZcUtil.translateColName(conditionJTabelPanel.getTable(), ZcEmExpertSelectionToTableModelConverter.escColumns);    conditionJTabelPanel.setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmEvaluationConditionToTableMode(currentBill      .getExpertEvalConditionList()));  }  @SuppressWarnings("unchecked")  public void refreshExcludeExpertListTable() {    ZcUtil.translateColName(excludeJTabelPanel.getTable(), ZcEmExpertSelectionToTableModelConverter.eelColumns);    excludeJTabelPanel      .setTableModel(ZcEmExpertSelectionToTableModelConverter.convertEmExpertBillFilterToTableMode(currentBill.getExpertEvaluationList()));  }  public void doHelp() {    setButtonStatus();  }  private void stopTableEditing() {    JPageableFixedTable table = this.tablePanel.getTable();    if (table.isEditing()) {      table.getCellEditor().stopCellEditing();    }    if (conditionJTabelPanel.getTable().isEditing()) {      conditionJTabelPanel.getTable().getCellEditor().stopCellEditing();    }    if (excludeJTabelPanel.getTable().isEditing()) {      excludeJTabelPanel.getTable().getCellEditor().stopCellEditing();    }  }  public boolean isDataChanged() {    return !DigestUtil.digest(oldBill).equals(DigestUtil.digest(listCursor.getCurrentObject()));  }  void refreshParentForeignDialog(EmExpertSelectionBill bill) {    //   if(this.forenEntityDialog!=null&&this.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_NEW)){    //     this.forenEntityDialog.refresh(supplier);    //   }    this.forenEntityDialog.refresh(bill);  }  public String getPageStatus() {    return pageStatus;  }  public void setPageStatus(String pageStatus) {    this.pageStatus = pageStatus;  }  /*   * 检查是否完成了专家的抽取   */  private boolean isCompleteEval() {    if (this.currentBill != null) {      if (this.currentBill.getExpertEvalConditionList() != null && this.currentBill.getExpertEvaluationList() != null) {        int needExperts = caculateNeedExperts(this.currentBill.getExpertEvalConditionList());        if (needExperts == this.currentBill.getExpertEvaluationList().size()) {          return true;        } else {          return false;        }      }    }    return false;  }  private int caculateNeedExperts(List expertEvalConditionList) {    if (expertEvalConditionList == null)      return 0;    int rtn = 0;    for (int i = 0; i < expertEvalConditionList.size(); i++) {      EmEvaluationCondition con = (EmEvaluationCondition) expertEvalConditionList.get(i);      rtn = rtn + (con.getExpertNum() == null ? 0 : con.getExpertNum().intValue());    }    return rtn;  }}